The FileSystemObject object contains the following methods:
The BlobExists method checks to see if the Blob exists.
BlobExists(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The CheckInBlobFile method checks in the specified Blob file.
CheckInBlobFile(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The CheckOutBlobFile method checks out the specified Blob file.
CheckOutBlobFile(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The DeleteFileFromBlob method deletes the file from the specified Blob path.
DeleteFileFromBlob(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
Return Value: True if the delete was successful, False if it was not.
Errors: If BlobPath is invalid, an error will display.
Example
The following method deletes test.csw from CYGDEMO.BSS and alerts the user.
|
Sub deleteFile() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
objFileSystem.DeleteFileFromBlob("CYGDEMO.BSS\TEST\test.CSW") edtMessageBox.Text = "File Deleted" End Sub |
The DownloadBlobFile method downloads the specified file from the specified Blob service to the current working directory.
DownloadBlobFile(BlobSiteService As String, BlobFolder As String, FileName As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
|
BlobFolder |
Yes |
A valid folder name in BlobSiteService. |
|
FileName |
Yes |
A valid file name in BlobApplication. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be downloaded. Set to 1 to update the rules mask, or 0 to leave it as is. See UpdateRulesMask for more information about this parameter. |
The file will be downloaded to the current working directory. This depends on what is actually running the script. If you are running the script in CygNet Studio, then that will be the CygNet Studio directory. If the script is running in the HSS, then the HSS service folder will be the download location. Likewise, if you are running the script from the command line, then it will download the file to the current directory.
Return Value: True if the download was successful, False if it was not.
Errors: If BlobSiteService, BlobFolder, or FileName are invalid, an error will display.
Example
The following example downloads MeterTest.csf, and tells the user if it was successful or not.
|
Sub downloadFile() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.DownloadBlobFile("CYGDEMO.BSS", "TEST", "MeterTest.csf", 0)
If bRet Then edtMessageBox.Text = "File downloaded successfully" Else edtMessageBox.Text = "Error downloading file" End If End Sub |
The DownloadBlobFileToDirectory method downloads the specified file from a Blob service to the destination directory.
DownloadBlobFileToDirectory(BlobSiteService As String, BlobFolder As String, FileName As String, DestinationDir As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
|
BlobFolder |
Yes |
A valid folder name in BlobSiteService. |
|
FileName |
Yes |
A valid file name in BlobApplication. |
|
DestinationDir |
Yes |
The local file path to download the file to. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be downloaded. Set to 1 to update the rules mask, or 0 to leave it as is. See UpdateRulesMask for more information about this parameter. |
If DestinationDir does not already exist, its path will be created.
Return Value: True if the download was successful, False if it was not.
Errors: If BlobSiteService, BlobFolder, or FileName are invalid, an error will display.
Example
The following example downloads MeterTest.csf to C:\MyFolder and tells the user if it was successful or not.
|
Sub downloadFileToDir() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.DownloadBlobFileToDirectory("CYGDEMO.BSS", _ "TEST", "MeterTest.csf", "C:\MyFolder", 0)
If bRet Then edtMessageBox.Text = "File downloaded successfully" Else edtMessageBox.Text = "Error downloading file" End If End Sub |
The DownloadFromBlobPath method downloads the specified file from a Blob service to the current working directory.
DownloadFromBlobPath(BlobPath As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be downloaded. Set to 1 to update the rules mask, or 0 to leave it as is. See UpdateRulesMask for more information about this parameter. |
The file will be downloaded to the current working directory. This depends on what is actually running the script. If you are running the script in CygNet Studio, then that will be the CygNet Studio directory. If the script is running in the HSS, then the HSS service folder will be the download location. Likewise, if you are running the script from the command line, then it will download the file to the current directory.
Return Value: True if the download was successful, False if it was not.
Errors: If BlobPath is invalid, an error will display.
Example
The following example downloads MeterTest.csf using its blob path and tells the user if it was successful or not.
|
Sub downloadFilePath() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.DownloadFromBlobPath("CYGDEMO.BSS\TEST\MeterTest.csf", 0)
If bRet Then edtMessageBox.Text = "File downloaded successfully" Else edtMessageBox.Text = "Error downloading file" End If End Sub |
The DownloadFromBlobPathToDirectory method downloads the specified file from a Blob service to the destination directory.
DownloadFromBlobPathToDirectory(BlobPath As String, DestinationDir As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
DestinationDir |
Yes |
The local file path to download the file to. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be downloaded. Set to 1 to update the rules mask, or 0 to leave it as is. See UpdateRulesMask for more information about this parameter. |
If DestinationDir does not already exist, its path will be created.
Return Value: True if the download was successful, False if it was not.
Errors: If BlobPath is invalid, an error will display.
Example
The following example downloads MeterTest.csf using its blob path to C:\MyFolder and tells the user if it was successful or not.
|
Sub downloadFilePathToDir() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.DownloadFromBlobPathToDirectory( _ "CYGDEMO.BSS\TEST\MeterTest.csf", "C:\MyFolder", 0)
If bRet Then edtMessageBox.Text = "File downloaded successfully" Else edtMessageBox.Text = "Error downloading file" End If End Sub |
The EnableLibrarian method enables or disables the librarian state of the specified Blob folder. Also see IsLibrarianEnabled.
EnableLibrarian(BlobSiteService As String, Folder As String, Enable As Boolean) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
|
Folder |
Yes |
A valid folder name in BlobSiteService. |
|
Enable |
Yes |
A Boolean value indicating whether or not to enable librarian state for the specified Blob folder. |
The GetBlobFileCheckOutDetails method retrieves check out status details for the specified Blob file as a 2-D array.
GetBlobFileCheckOutDetails(BlobPath As String, DetailsArray) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
DetailsArray |
Yes |
An array of check out status details for the Blob file. |
The GetBlobFolderList method retrieves a list of all folders for the specified Blob service.
GetBlobFolderList(BlobSiteService As String)
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
Return Value: An array of folders in BlobSiteService. If BlobSiteService is invalid, an empty array will be returned.
Example
The following example gets all the foldersin CYGDEMO.APPS and displays them in a list box.
|
Sub getBlobFolderList() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim arrPathList, item arrPathList = objFileSystem.GetBlobFolderList("CYGDEMO.APPS") lstBlob.ResetContent For Each item In arrPathList lstBlob.AddString(item) Next End Sub |
The GetBlobFileListByFolder method retrieves a list of all file names in the specified Blob folder.
GetBlobFileListByFolder(BlobSiteService As String, Folder As String)
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
|
Folder |
Yes |
A valid folder name in BlobSiteService. |
Return Value: An array of names for all Blob files in the folder. If BlobSiteService or Folder is invalid, an empty array will be returned.
Example
The following example gets all files in the HELP folderand displays them in a list box.
|
Sub getBlobByFolder() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim arrPathList, item arrPathList = objFileSystem.GetBlobFileListByFolder("CYGDEMO.APPS", "HELP") lstBlob.ResetContent For Each item In arrPathList lstBlob.AddString(item) Next End Sub |
The GetBlobPathList method retrieves a list of all Blob file paths in the specified Blob service.
GetBlobPathList(BlobSiteService As String)
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
Return Value: An array of file paths for all blob files in the service. If BlobSiteService is invalid, an empty array will be returned.
Example
The following example gets the file paths for CYGDEMO.BSS and displays them in a list box.
|
Sub getBlobPaths() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim arrPathList, item arrPathList = objFileSystem.GetBlobPathList("CYGDEMO.BSS") lstBlob.ResetContent For Each item In arrPathList lstBlob.AddString(item) Next End Sub |
The IsBlobFileCheckedOut method checks if the specified Blob file is checked out.
IsBlobFileCheckedOutByAnotherUser(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The IsBlobFileCheckedOutByAnotherUser method checks if the specified Blob file is checked out by another user.
IsBlobFileCheckedOutByAnotherUser(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The IsBlobFileCheckedOutByCurrentUser method checks if the specified Blob file is checked out by the current user.
IsBlobFileCheckedOutByCurrentUser(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The IsLibrarianEnabled method returns the librarian enabled state of the specified Blob folder. See also EnableLibrarian.
IsLibrarianEnabled(BlobSiteService As String, Folder As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" format. |
|
Folder |
Yes |
A valid folder name in BlobSiteService. |
The IsValidBlobPath checks if the format for the Blob path is valid.
IsValidBlobPath(BlobPath As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
The ReadBlobString method reads the contents of the specified Blob file to the provided string. Optionally, you can include a Blob file in a BSS on a different domain.
ReadBlobString(BlobPath As String) As String
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. You can specify a domain for a BSS on another domain, as necessary: "[10003]site.service\folder\file" |
Return Value: A string containing the contents of the file.
Errors: If BlobPath is invalid, an error will display.
Example
The following example reads the contents of a text file from CYGDEMO.BSS on domain 10003.
|
Sub readString() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim strRet strRet = objFileSystem.ReadBlobString("[10003]CYGDEMO.BSS\INCLUDE\READTEST.TXT") WScript.Echo strRet End Sub |
The UndoCheckOut method revokes a check out for a Blob file. Optionally allows a user with admin access to force an undo action against another user's checkout.
UndoCheckOut(BlobPath As String, ForceUndo As Boolean) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
ForceUndo |
Yes |
The UploadFileToBlob method uploads the specified file from a local source directory to the specified Blob folder.
UploadFileToBlob(BlobSiteService As String, BlobFolder As String, SourceFileName As String, SourceFileDirectory As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobSiteService |
Yes |
A valid service name, in "site.service" form. |
|
BlobFolder |
Yes |
A valid foldername in BlobSiteService. |
|
SourceFileName |
Yes |
The file name of the file to copy. |
|
SourceFileDirectory |
Yes |
The directory of the file to copy. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be uploaded. Set to 1 to update the rules mask, or 0 to leave it as is. See UpdateRulesMask for more information about this parameter. |
Return Value: A Boolean indicating if the method succeeded.
Errors: If any of the properties are invalid, an error will display.
Example
The following example uploads C:\MyFolder\TestScreen.csf to CYGDEMO.BSS\TEST and tells the user whether or not the operation was successful.
|
Sub uploadFile() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.UploadFileToBlob("CYGDEMO.BSS", "TEST", _ "TestScreen.csf", "C:\MyFolder", 0)
If bRet Then edtMessageBox.Text = "File upload successful" Else edtMessageBox.Text = "Error uploading file" End If End Sub |
The UploadFileToBlobPath method uploads the specified file from a local source directory to the specified Blob path.
UploadFileToBlobPath(BlobPath As String, SourceFileName As String, SourceFileDirectory As String, UpdateRulesMask As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
SourceFileName |
Yes |
The file name of the file to copy. |
|
SourceFileDirectory |
Yes |
The file directory of the file to copy. |
|
UpdateRulesMask |
Yes |
Used to determine whether the file will be uploaded. Set to 1 to update the rules mask, or 0 to leave it as is. |
Return Value: A Boolean indicating if the method succeeded.
Errors: If any of the properties are invalid, an error will display.
Example
The following example uploads C:\MyFolder\uploadtest.txt to CYGDEMO.BSS\TEST\uploadtest.txt and tells the user whether or not the operation was successful.
|
Sub uploadFilePath() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.UploadFileToBlobPath("CYGDEMO.BSS\TEST\file.txt", _ "uploadtest.txt", "C:\MyFolder", 0)
If bRet Then edtMessageBox.Text = "File upload successful" Else edtMessageBox.Text = "Error uploading file" End If End Sub |
The WriteBlobString method writes the provided string to the specified Blob path.
WriteBlobString(BlobPath As String, Value As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
BlobPath |
Yes |
A valid Blob file path, in "site.service\folder\file" format. |
|
Value |
Yes |
The information to store in the file. |
If any folders in BlobPath do not exist, they will be created.
Return Value: A Boolean indicating if the method succeeded.
Example
The following example writes information to CYGDEMO.BSS\WRITE\Stuff.txt and tells the user whether or not the operation was successful.
|
Sub writeBlob() Dim objFileSystem Set objFileSystem = CreateObject("CxScript.FileSystemObject")
Dim bRet bRet = objFileSystem.WriteBlobString("CYGDEMO.BSS\Write\Stuff.txt", "text text")
If bRet Then edtMessageBox.Text = "File upload successful" Else edtMessageBox.Text = "Error uploading file" End If End Sub |